<?php

import("data.db.DbAbstractTable");
import("data.db.DbFactory");

class DbContentUnit extends DbAbstractTable {
	
	public $className = "data.logic.content.ContentUnit";
	
	//
	// SQL Table description section
	//
	const TB_TABLENAME	= "pd_unitblock";
	const TB_I			= 'ubl';
	
	const TB_DATE		= 'ubl_date';
	const TB_AUTHOR		= 'ubl_author';
	const TB_TITLE		= 'ubl_title';
	const TB_CATEGORY	= 'ubl_category';
	
	public static function _get_TABLENAME() {return self::TB_TABLENAME;}
	public static function _get_ID() {return self::TB_I."_id";}
	public static function _get_SUFFIX() {return self::TB_I;}
	//
	//
	
	// properties
	public $date;
	public $author;
	public $title;
	public $category;
	
	function __construct($noinit=false) {
		parent::__construct($noinit);
	}
	
	function getDate() {
		return $this->date;
	}
	
	function setDate($value) {
		$this->date = $value;
	}
	
	function getAuthor() {
		return $this->author;
	}
	
	function setAuthor($value) {
		$this->author = $value;
	}
	
	function getTitle() {
		return $this->title;
	}
	
	function setTitle($value) {
		$this->title = $value;
	}
	
	function getCategoryId() {
		return $this->category;
	}
	
	function setCategoryId($value) {
		$this->category = $value;
	}
	
	// restore
	function fillEntity($arrResult) {
		parent::fillEntity($arrResult);
		$this->setDate($arrResult[self::TB_DATE]);
		$this->setAuthor($arrResult[self::TB_AUTHOR]);
		$this->setTitle($arrResult[self::TB_TITLE]);
		$this->setCategoryId($arrResult[self::TB_CATEGORY]);
	}
	
	//store
	function fillFields() {
		parent::fillFields();
		$this->fildsForStore[self::TB_DATE] = "'".$this->getDate()."'";
		$this->fildsForStore[self::TB_AUTHOR] = "'".$this->getAuthor()."'";
		$this->fildsForStore[self::TB_TITLE] = "'".$this->getTitle()."'";
		$this->fildsForStore[self::TB_CATEGORY] = "'".$this->getCategoryId()."'";
	}
}
?>